
package client;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JTextField;

public class DefaultUnEditableJTextField extends JTextField implements MouseListener{
	private static final long serialVersionUID = -3996533656556699625L;
	public DefaultUnEditableJTextField() {
		super();
		this.setEditable(false);
		this.addMouseListener(this);
	}
	public DefaultUnEditableJTextField(int columns) {
		super(columns);
		this.setEditable(false);
		this.addMouseListener(this);
	}
	public DefaultUnEditableJTextField(String text) {
		super(text);
		this.setEditable(false);
		this.addMouseListener(this);
	}
	public DefaultUnEditableJTextField(String text,int columns) {
		super(text,columns);
		this.setEditable(false);
		this.addMouseListener(this);
	}
	

	/* (non-Javadoc)
	 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseClicked(MouseEvent e) {
		if(e.getClickCount()==2){
			this.setEditable(true);
		}
	}

	/* (non-Javadoc)
	 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
	 */
	@Override
	public void mousePressed(MouseEvent e) {
	}

	/* (non-Javadoc)
	 * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseReleased(MouseEvent e) {
	}

	/* (non-Javadoc)
	 * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseEntered(MouseEvent e) {
		if(e.getClickCount()==2){
			this.setEditable(true);
		}
	}

	/* (non-Javadoc)
	 * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseExited(MouseEvent e) {
		this.setEditable(false);
	}
}
